function orderDetail($scope, $http) {
	orders = eval('(' + readData(localStorage.order) + ')');
	$scope.showFast = false;
	orderId = orders['orderId'];
	url = getUrl("38orderDetail");
	header = getHeader();
	params = 'id=' + orderId;
	//订单详情
	$http({
		method: 'POST',
		url: url,
		headers: header,
		timeout: 10000,
		//cache: true,
		data: params
	}).success(function(data, status, headers, config) {
		if (data.obj) {
			//订单信息
			var orderInfor = data.obj.orderInfo;
			orderInfor['cstatus'] = orderStatus(orderInfor['status'], orderInfor['isRefund']);
			orderInfor['btnstatus'] = orderStatusCode(orderInfor['status']);
			if (orderInfor['isRefund'] == "n") {
				orderInfor.isShow = true;
			} else {
				orderInfor.isShow = false;
			}
			if (orderInfor['status'] == "pass") {
				orderInfor.btnShow = "false";
			}
			if (orderInfor['expressNo']) {
				$scope.fast = true;
			}
			if (orderInfor.closedComment == "y") {
				orderInfor.btn = false;
			} else {
				orderInfor.btn = true;
			}
			$scope.orderInfor = orderInfor;
			//商品信息
			//$scope.goodsList = data.obj.productList;
			var produ = data.obj.productList;
			//判断规格尺寸显示隐藏
			for (var i = 0; i < produ.length; i++) {
				if (produ[i].SpecColor) {
					produ[i].ngcolor = "false";
				} else {
					produ[i].ngcolor = "true";
				}
				if (produ[i].SpecSize) {
					produ[i].ngsize = "false";
				} else {
					produ[i].ngsize = "true";
				}
				if (produ[i].SpecSpec) {
					produ[i].ngspec = "false";
				} else {
					produ[i].ngspec = "true";
				}
				if (produ[i].SpecModel) {
					produ[i].ngmodel = "false";
				} else {
					produ[i].ngmodel = "true";
				}
			}
			$scope.goodsList = produ;
			//发票信息
			if (data.obj.invoice) {
				$scope.invoice = data.obj.invoice;
				if (data.obj.invoice.invoicetype) {
					if (data.obj.invoice.invoicetype == "无") {
						document.getElementById("first").style.lineHeight = 65 + "px";
					}
				}
			}
			//地址信息
			$scope.orderShip = data.obj.ordership;
			//配送方式
			if (data.obj.ordership) {
				$scope.carryType = '物流';
				$scope.showFast = true;
			} else {
				$scope.carryType = '自提'
			}
			//店铺信息
			$scope.marketShop = data.obj.marketShop;
			$scope.heji = (parseFloat(orderInfor.amount) - parseFloat(orderInfor.discountPay) - parseFloat(orderInfor.reduceAmount)).toFixed(2);
		} else {
			$scope.orderInfor = null;
			$scope.goodsList = null;
			$scope.invoice = null;
			$scope.orderShip = null;
			$scope.marketShop = null;
		};

	}).error(function(data, status, headers, config) {
		mui.toast('网络链接异常，请稍后重试');
	});
	//取消订单
	$scope.cancle = function() {
			urlc = getUrl("45orderCancle");
			headerc = getHeader();
			mui.confirm('确定要取消订单？', '取消订单', ['取消', '确认'], function(ret) {

				if (ret.index == 1) {
					plus.nativeUI.showWaiting("请等待…")
					$http({
						method: 'POST',
						url: urlc,
						headers: headerc,
						timeout: 10000,
						//cache: true,
						data: 'id=' + orderId
					}).success(function(data, status, headers, config) {
						if (data.msg == 'success') {
							refreshOrderManager();
							closeself();
						} else {
							mui.toast("网络链接异常，请稍后重试(e)" + data.code);
						};
						plus.nativeUI.closeWaiting()
					}).error(function(data, status, headers, config) {
						plus.nativeUI.closeWaiting()
						mui.toast("网络链接异常，请稍后重试(e)");
					});
				}
			})

		}
		//评价订单
	$scope.pj = function() {
			openOrderJudge();
		}
		//支付订单
	$scope.pay = function() {
			openOrderPay();
		}
		//确认收货
	$scope.check = function() {
			urlc = getUrl("29receiveCheck");
			headerc = getHeader();
			mui.confirm('请确认收到商品后再提交', '确认收货', ['取消', '确认'], function(ret) {
				if (ret.index == 1) {
					plus.nativeUI.showWaiting("请等待…")
					$http({
						method: 'POST',
						url: urlc,
						headers: headerc,
						timeout: 10000,
						//cache: true,
						data: 'id=' + orderId
					}).success(function(data, status, headers, config) {
						if (data.msg == 'success') {
							refreshOrderManager();
							closeself();
						} else if (data.code == "1") {
							mui.toast("您的订单还未发货")
						} else {
							mui.toast("网络链接异常，请稍后重试" + data.code);
						}
						plus.nativeUI.closeWaiting();
					}).error(function(data, status, headers, config) {
						plus.nativeUI.closeWaiting();
						mui.toast("网络链接异常，请稍后重试");
					});
				}
			})

		}
		//取消退货
	$scope.callTui = function() {
			api.alert({
				title: '提示',
				msg: '申请退货',
				buttons: ['确定']
			}, function(ret, err) {
				//coding...
			});
		}
		//删除订单
	$scope.del = function() {
			urlc = getUrl("30orderDelete");
			headerc = getHeader();
			mui.confirm('订单删除后将无法查看，您确定要删除？', '删除订单', ['取消', '确认'], function(ret) {
				if (ret.index == 1) {
					plus.nativeUI.showWaiting("请等待…")
					$http({
						method: 'POST',
						url: urlc,
						headers: headerc,
						timeout: 10000,
						//cache: true,
						data: 'id=' + orderId
					}).success(function(data, status, headers, config) {
						if (data.msg == 'success') {
							refreshOrderManager();
							closeself();
						} else {
							mui.toast("网络链接异常，请稍后重试" + data.code);
						};
						plus.nativeUI.closeWaiting();
					}).error(function(data, status, headers, config) {
						plus.nativeUI.closeWaiting();
						mui.toast("网络链接异常，请稍后重试(e)");
					});
				}
			})

		}
		//再次购买
	$scope.buyAgain = function() {
		mui.toast("再次购买功能暂未开放")
	}
}

function orderStatusCode(status) {
	var statusCode;
	switch (status) {
		case 'init':
			//未支付  操作去支付 取消订单
			statusCode = 1;
			break;
		case 'pass':
			//支付完成  确认收货   申请退货
			statusCode = 2;
			break;
		case 'send':
			//已发货  确认收货
			statusCode = 3;
			break;
		case 'sign':
			//已经签收
			//statusCode = 4;
			statusCode = 8;
			//已收货  评价  申请退货
			break;
		case 'cancel':
			statusCode = 5;
			//取消  删除 再次购买
			break;
		case 'file':
			//statusCode = 6;
			statusCode = 4;
			//已完成  待评价
			break;
		case 'finish':
			statusCode = 7;
			//交易关闭  删除 再次购买 退货
			break;
	}
	return statusCode
}

function closeself() {
	setTimeout(function() {
		mui.back()
	}, 300)
}